Skip to contentSkip to conversation

gcc: remove .gnu_debuglink from SDK toolchain binaries

PATCH In review [email protected] 3 participants 4 messages Aug 25, 2025 – Aug 29, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gcc: remove .gnu_debuglink from SDK toolchain binaries

From: Deepesh Varatharajan <[email protected]>

SDK toolchain binaries (nativesdk and cross-canadian gcc) currently contain a .gnu_debuglink section pointing to separate debug symbols. These symbols are not required in SDK builds, as SDK users do not need production debug information on the target, only the compiler and headers for development.

Including .gnu_debuglink increases disk usage for distributed SDKs without providing any benefit for SDK consumers and so removed.

---
 meta/recipes-devtools/gcc/gcc-common.inc | 5 +++++
 1 file changed, 5 insertions(+)
meta/recipes-devtools/gcc/gcc-common.inc +5 -0
index 8d95698743..3793aff0a1 100644
@@ -144,3 +144,8 @@ remove_sysroot_paths_from_checksum_options () {
 cleanup_installed_include_fixed () {
 	find ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include-fixed -type f -not -name "README" -not -name limits.h -not -name syslimits.h | xargs rm -f
 }
+
+# Disable splitting debug symbols into separate -dbg packages for SDK-related gcc builds
+# (covers both nativesdk gcc and cross-canadian gcc)
+INHIBIT_PACKAGE_DEBUG_SPLIT:class-nativesdk = "1"
+INHIBIT_PACKAGE_DEBUG_SPLIT:class-cross-canadian = "1"
Signature · 1 line
2.49.0
#1 lore raw
Quoted 11 lines · Deepesh via lists.openembedded.org

From: Deepesh Varatharajan <[email protected]>

SDK toolchain binaries (nativesdk and cross-canadian gcc) currently contain a .gnu_debuglink section pointing to separate debug symbols. These symbols are not required in SDK builds, as SDK users do not need production debug information on the target, only the compiler and headers for development.

Including .gnu_debuglink increases disk usage for distributed SDKs without providing any benefit for SDK consumers and so removed.

I need to understand the problem a bit better. Is the system not able to specify ignoring debug info from SDK, if we include debuginfo with the
binaries how does it change things ?

Quoted 31 lines
---
 meta/recipes-devtools/gcc/gcc-common.inc | 5 +++++
 1 file changed, 5 insertions(+)
meta/recipes-devtools/gcc/gcc-common.inc +5 -1
index 8d95698743..3793aff0a1 100644
@@ -144,3 +144,8 @@ remove_sysroot_paths_from_checksum_options () {
 cleanup_installed_include_fixed () {
        find ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include-fixed -type f -not -name "README" -not -name limits.h -not -name syslimits.h | xargs rm -f
 }
+
+# Disable splitting debug symbols into separate -dbg packages for SDK-related gcc builds
+# (covers both nativesdk gcc and cross-canadian gcc)
+INHIBIT_PACKAGE_DEBUG_SPLIT:class-nativesdk = "1"
+INHIBIT_PACKAGE_DEBUG_SPLIT:class-cross-canadian = "1"
--

2.49.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#222417): https://lists.openembedded.org/g/openembedded-core/message/222417
Mute This Topic: https://lists.openembedded.org/mt/114885056/1997914
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#2 lore raw
Quoted 14 lines · Khem Raj

CAUTION: This email comes from a non Wind River email account!
Do not click links or open attachments unless you recognize the sender and know the content is safe.

Quoted 8 lines · Deepesh via lists.openembedded.org

From: Deepesh Varatharajan<[email protected]>

SDK toolchain binaries (nativesdk and cross-canadian gcc) currently contain a .gnu_debuglink section pointing to separate debug symbols. These symbols are not required in SDK builds, as SDK users do not need production debug information on the target, only the compiler and headers for development.

Quoted 5 lines
Quoted 2 lines

Including .gnu_debuglink increases disk usage for distributed SDKs without providing any benefit for SDK consumers and so removed.

I need to understand the problem a bit better. Is the system not able to specify ignoring debug info from SDK, if we include debuginfo with the
binaries how does it change things ?

Hi Khem,

The |meta-mingw| layer currently sets |INHIBIT_PACKAGE_DEBUG_SPLIT = "1"| in its |"gcc-cross-canadian_%.bbappend|", which results in the |".gnu_debuglink"| section being stripped from the cross-canadian GCC binaries. This behavior leads to inconsistencies in the generated SDKs depending on whether the |meta-mingw| layer is included or not.

So the idea is to make this behaviour as default in the gcc-common.inc file for both nativesdk and cross-canadian GCC. To ensure consistent SDK behavior and to reduce SDK size.

The below are the differences in binaries :

Binary                                Before      After      Diff (bytes) --------------------------               --------- --------      ----------- nativesdk             x86_64-pokysdk-linux-gcc      2165192 2165080     -112 nativesdk             x86_64-pokysdk-linux-g++     2169288 2169176     -112 cross-canadian   x86_64-poky-linux-gcc            2165216 2165112     -104 cross-canadian   x86_64-poky-linux-g++           2173408 2173304     -104

Regards,
Deepesh

Quoted 31 lines
Quoted 31 lines
---
  meta/recipes-devtools/gcc/gcc-common.inc | 5 +++++
  1 file changed, 5 insertions(+)
meta/recipes-devtools/gcc/gcc-common.inc +5 -1
index 8d95698743..3793aff0a1 100644
@@ -144,3 +144,8 @@ remove_sysroot_paths_from_checksum_options () {
  cleanup_installed_include_fixed () {
         find ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include-fixed -type f -not -name "README" -not -name limits.h -not -name syslimits.h | xargs rm -f
  }
+
+# Disable splitting debug symbols into separate -dbg packages for SDK-related gcc builds
+# (covers both nativesdk gcc and cross-canadian gcc)
+INHIBIT_PACKAGE_DEBUG_SPLIT:class-nativesdk = "1"
+INHIBIT_PACKAGE_DEBUG_SPLIT:class-cross-canadian = "1"
--

2.49.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#222417):https://lists.openembedded.org/g/openembedded-core/message/222417 Mute This Topic:https://lists.openembedded.org/mt/114885056/1997914
Group Owner:[email protected] Unsubscribe:https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#3 lore raw
Quoted 33 lines · Deepesh via lists.openembedded.org

Quoted 13 lines · Khem Raj

On Mon, Aug 25, 2025 at 9:51 AM Varatharajan, Deepesh via lists.openembedded.org <[email protected]> wrote:

Quoted 9 lines


From: Deepesh Varatharajan <[email protected]>

SDK toolchain binaries (nativesdk and cross-canadian gcc) currently contain a .gnu_debuglink section pointing to separate debug symbols. These symbols are not required in SDK builds, as SDK users do not need production debug information on the target, only the compiler and headers for development.

Quoted 8 lines
Quoted 3 lines

Including .gnu_debuglink increases disk usage for distributed SDKs without providing any benefit for SDK consumers and so removed.


I need to understand the problem a bit better. Is the system not able to specify ignoring debug info from SDK, if we include debuginfo with the binaries how does it change things ?

The meta-mingw layer currently sets INHIBIT_PACKAGE_DEBUG_SPLIT = "1" in its "gcc-cross-canadian_%.bbappend", which results in the ".gnu_debuglink" section being stripped from the cross-canadian GCC binaries. This behavior leads to inconsistencies in the generated SDKs depending on whether the meta-mingw layer is included or not.
 So the idea is to make this behaviour as default in the gcc-common.inc file for both nativesdk and cross-canadian GCC. To ensure consistent SDK behavior and to reduce SDK size.

Quoted 8 lines

 The below are the differences in binaries :

                                         Binary                                Before      After      Diff (bytes) --------------------------               ---------       --------      ----------- nativesdk             x86_64-pokysdk-linux-gcc      2165192    2165080     -112
 nativesdk             x86_64-pokysdk-linux-g++     2169288    2169176     -112
 cross-canadian   x86_64-poky-linux-gcc            2165216    2165112     -104
 cross-canadian   x86_64-poky-linux-g++           2173408    2173304     -104

Please do not use the mingw layer as a reference for anything! It takes various shortcuts to make things work on a problematic and quite different platform and it's hacks shouldn't be taken and applied generically.

The debug link sections are only a handful of bytes and the size of these should not matter compared to the size of the SDK. They do provide valuable information about which debug symbols match the binaries so "after the fact" you could find debug symbols to debug a segfault thanks to our reproducible builds (for example).

In general we always generate debug symbols and package them separately for target binaries (which includes nativesdk). Mingw doesn't do this for various reasons, probably breakage if it's binaries are stripped.

Cheers,

Richard